const express = require("express")
const apirouter = express.Router()

apirouter.get("/user",(req,res)=>{
       console.log("api路由");
       let data = {
           status:200,
           msg:"GET请求成功！",
           data:{
               name:"张三",
               age:20,
               gender:"男"
           }
       }
       res.send(data)
})

apirouter.post("/book",(req,res)=>{
    console.log("api路由");
    console.log(req.body);
    let data = {
        status:200,
        msg:"post请求成功！",
        data:{
            name:"张三",
            age:20,
            gender:"男"
        },
        body:req.body
    }
    res.send(data)
})

module.exports=apirouter